<?php

	function calcularPos($direccion){
		// http://maps.googleapis.com/maps/api/geocode/json?address=Elcondor2698,Rafael%20Calzada,Buenos%20Aires,Argentina&sensor=false
	//	$service_url = 'http://maps.googleapis.com/maps/api/geocode/json?address=Elcondor2698,Rafael Calzada,Buenos Aires,Argentina&sensor=false';
       // $curl_post_data = array(
            // "address" => $direccion,
            // "sensor" => 'false',
            // );
        $cityclean = str_replace (" ", "+", $direccion);    
        $details_url = "https://maps.googleapis.com/maps/api/geocode/json?address=". $cityclean ."&sensor=false";
   		var_dump($details_url);
   		$ch = curl_init();
	   	curl_setopt($ch, CURLOPT_URL, $details_url);
	   	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	   	//$geoloc = json_decode(curl_exec($ch), true);
        $geoloc = curl_exec($ch);
        var_dump($geoloc);
		var_dump(curl_error($ch));
        curl_close($ch);
		
        //return $response; 
	}

?>